
/*
===============================================================================
                    EntitySpaces Studio by EntitySpaces, LLC
             Persistence Layer and Business Objects for Microsoft .NET
             EntitySpaces(TM) is a legal trademark of EntitySpaces, LLC
                          http://www.entityspaces.net
===============================================================================
EntitySpaces Version : 2012.1.0930.0
EntitySpaces Driver  : SQL
Date Generated       : 2016/7/28 0:24:06
===============================================================================
*/

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Linq;
using System.Data;
using System.ComponentModel;
using System.Xml.Serialization;
using System.Runtime.Serialization;

using EntitySpaces.Core;
using EntitySpaces.Interfaces;
using EntitySpaces.DynamicQuery;



namespace yncTech.BusinessObjects
{
	/// <summary>
	/// Encapsulates the 'V_LendBox' view
	/// </summary>

    [DebuggerDisplay("Data = {Debug}")]
	[Serializable]
	[DataContract]
	[KnownType(typeof(VLendBox))]	
	[XmlType("VLendBox")]
	public partial class VLendBox : esVLendBox
	{	
		[DebuggerBrowsable(DebuggerBrowsableState.RootHidden | DebuggerBrowsableState.Never)]
		protected override esEntityDebuggerView[] Debug
		{
			get { return base.Debug; }
		}

		override public esEntity CreateInstance()
		{
			return new VLendBox();
		}
		
		#region Static Quick Access Methods
		
		#endregion

		
					
		
	
	}



    [DebuggerDisplay("Count = {Count}")]
	[Serializable]
	[CollectionDataContract]
	[XmlType("VLendBoxCollection")]
	public partial class VLendBoxCollection : esVLendBoxCollection, IEnumerable<VLendBox>
	{

		
		
		#region WCF Service Class
		
		[DataContract]
		[KnownType(typeof(VLendBox))]
		public class VLendBoxCollectionWCFPacket : esCollectionWCFPacket<VLendBoxCollection>
		{
			public static implicit operator VLendBoxCollection(VLendBoxCollectionWCFPacket packet)
			{
				return packet.Collection;
			}

			public static implicit operator VLendBoxCollectionWCFPacket(VLendBoxCollection collection)
			{
				return new VLendBoxCollectionWCFPacket() { Collection = collection };
			}
		}
		
		#endregion
		
				
	}



    [DebuggerDisplay("Query = {Parse()}")]
	[Serializable]	
	public partial class VLendBoxQuery : esVLendBoxQuery
	{
		public VLendBoxQuery():this("VLendBoxQuery")
		{
		}
		public VLendBoxQuery(string joinAlias)
		{
			this.es.JoinAlias = joinAlias;
		}	

		override protected string GetQueryName()
		{
			return "VLendBoxQuery";
		}
		
					
	
		#region Explicit Casts
		
		public static explicit operator string(VLendBoxQuery query)
		{
			return VLendBoxQuery.SerializeHelper.ToXml(query);
		}

		public static explicit operator VLendBoxQuery(string query)
		{
			return (VLendBoxQuery)VLendBoxQuery.SerializeHelper.FromXml(query, typeof(VLendBoxQuery));
		}
		
		#endregion		
	}

	[DataContract]
	[Serializable]
	abstract public partial class esVLendBox : esEntity
	{
		public esVLendBox()
		{

		}
		
		#region LoadByPrimaryKey
		
		#endregion
		
		#region Properties
		
		
		
		/// <summary>
		/// Maps to V_LendBox.LendID
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.Decimal? LendID
		{
			get
			{
				return base.GetSystemDecimal(VLendBoxMetadata.ColumnNames.LendID);
			}
			
			set
			{
				if(base.SetSystemDecimal(VLendBoxMetadata.ColumnNames.LendID, value))
				{
					OnPropertyChanged(VLendBoxMetadata.PropertyNames.LendID);
				}
			}
		}		
		
		/// <summary>
		/// Maps to V_LendBox.ThirdUnitID
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.Decimal? ThirdUnitID
		{
			get
			{
				return base.GetSystemDecimal(VLendBoxMetadata.ColumnNames.ThirdUnitID);
			}
			
			set
			{
				if(base.SetSystemDecimal(VLendBoxMetadata.ColumnNames.ThirdUnitID, value))
				{
					OnPropertyChanged(VLendBoxMetadata.PropertyNames.ThirdUnitID);
				}
			}
		}		
		
		/// <summary>
		/// Maps to V_LendBox.LendDate
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.DateTime? LendDate
		{
			get
			{
				return base.GetSystemDateTime(VLendBoxMetadata.ColumnNames.LendDate);
			}
			
			set
			{
				if(base.SetSystemDateTime(VLendBoxMetadata.ColumnNames.LendDate, value))
				{
					OnPropertyChanged(VLendBoxMetadata.PropertyNames.LendDate);
				}
			}
		}		
		
		/// <summary>
		/// Maps to V_LendBox.Loanee
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String Loanee
		{
			get
			{
				return base.GetSystemString(VLendBoxMetadata.ColumnNames.Loanee);
			}
			
			set
			{
				if(base.SetSystemString(VLendBoxMetadata.ColumnNames.Loanee, value))
				{
					OnPropertyChanged(VLendBoxMetadata.PropertyNames.Loanee);
				}
			}
		}		
		
		/// <summary>
		/// Maps to V_LendBox.ReturnDate
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.DateTime? ReturnDate
		{
			get
			{
				return base.GetSystemDateTime(VLendBoxMetadata.ColumnNames.ReturnDate);
			}
			
			set
			{
				if(base.SetSystemDateTime(VLendBoxMetadata.ColumnNames.ReturnDate, value))
				{
					OnPropertyChanged(VLendBoxMetadata.PropertyNames.ReturnDate);
				}
			}
		}		
		
		/// <summary>
		/// Maps to V_LendBox.LoaneeEmail
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String LoaneeEmail
		{
			get
			{
				return base.GetSystemString(VLendBoxMetadata.ColumnNames.LoaneeEmail);
			}
			
			set
			{
				if(base.SetSystemString(VLendBoxMetadata.ColumnNames.LoaneeEmail, value))
				{
					OnPropertyChanged(VLendBoxMetadata.PropertyNames.LoaneeEmail);
				}
			}
		}		
		
		/// <summary>
		/// Maps to V_LendBox.ActReturnDate
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.DateTime? ActReturnDate
		{
			get
			{
				return base.GetSystemDateTime(VLendBoxMetadata.ColumnNames.ActReturnDate);
			}
			
			set
			{
				if(base.SetSystemDateTime(VLendBoxMetadata.ColumnNames.ActReturnDate, value))
				{
					OnPropertyChanged(VLendBoxMetadata.PropertyNames.ActReturnDate);
				}
			}
		}		
		
		/// <summary>
		/// Maps to V_LendBox.Attachment
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String Attachment
		{
			get
			{
				return base.GetSystemString(VLendBoxMetadata.ColumnNames.Attachment);
			}
			
			set
			{
				if(base.SetSystemString(VLendBoxMetadata.ColumnNames.Attachment, value))
				{
					OnPropertyChanged(VLendBoxMetadata.PropertyNames.Attachment);
				}
			}
		}		
		
		/// <summary>
		/// Maps to V_LendBox.Comments
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String Comments
		{
			get
			{
				return base.GetSystemString(VLendBoxMetadata.ColumnNames.Comments);
			}
			
			set
			{
				if(base.SetSystemString(VLendBoxMetadata.ColumnNames.Comments, value))
				{
					OnPropertyChanged(VLendBoxMetadata.PropertyNames.Comments);
				}
			}
		}		
		
		/// <summary>
		/// Maps to V_LendBox.CreatedBy
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String CreatedBy
		{
			get
			{
				return base.GetSystemString(VLendBoxMetadata.ColumnNames.CreatedBy);
			}
			
			set
			{
				if(base.SetSystemString(VLendBoxMetadata.ColumnNames.CreatedBy, value))
				{
					OnPropertyChanged(VLendBoxMetadata.PropertyNames.CreatedBy);
				}
			}
		}		
		
		/// <summary>
		/// Maps to V_LendBox.CreatedDttm
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.DateTime? CreatedDttm
		{
			get
			{
				return base.GetSystemDateTime(VLendBoxMetadata.ColumnNames.CreatedDttm);
			}
			
			set
			{
				if(base.SetSystemDateTime(VLendBoxMetadata.ColumnNames.CreatedDttm, value))
				{
					OnPropertyChanged(VLendBoxMetadata.PropertyNames.CreatedDttm);
				}
			}
		}		
		
		/// <summary>
		/// Maps to V_LendBox.UpdatedBy
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String UpdatedBy
		{
			get
			{
				return base.GetSystemString(VLendBoxMetadata.ColumnNames.UpdatedBy);
			}
			
			set
			{
				if(base.SetSystemString(VLendBoxMetadata.ColumnNames.UpdatedBy, value))
				{
					OnPropertyChanged(VLendBoxMetadata.PropertyNames.UpdatedBy);
				}
			}
		}		
		
		/// <summary>
		/// Maps to V_LendBox.UpdatedDttm
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.DateTime? UpdatedDttm
		{
			get
			{
				return base.GetSystemDateTime(VLendBoxMetadata.ColumnNames.UpdatedDttm);
			}
			
			set
			{
				if(base.SetSystemDateTime(VLendBoxMetadata.ColumnNames.UpdatedDttm, value))
				{
					OnPropertyChanged(VLendBoxMetadata.PropertyNames.UpdatedDttm);
				}
			}
		}		
		
		/// <summary>
		/// Maps to V_LendBox.LendStatus
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.Int32? LendStatus
		{
			get
			{
				return base.GetSystemInt32(VLendBoxMetadata.ColumnNames.LendStatus);
			}
			
			set
			{
				if(base.SetSystemInt32(VLendBoxMetadata.ColumnNames.LendStatus, value))
				{
					OnPropertyChanged(VLendBoxMetadata.PropertyNames.LendStatus);
				}
			}
		}		
		
		/// <summary>
		/// Maps to V_LendBox.BoxCount
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.Int32? BoxCount
		{
			get
			{
				return base.GetSystemInt32(VLendBoxMetadata.ColumnNames.BoxCount);
			}
			
			set
			{
				if(base.SetSystemInt32(VLendBoxMetadata.ColumnNames.BoxCount, value))
				{
					OnPropertyChanged(VLendBoxMetadata.PropertyNames.BoxCount);
				}
			}
		}		
		
		/// <summary>
		/// Maps to V_LendBox.ThirunitIDName
		/// </summary>
		[DataMember(EmitDefaultValue=false)]
		virtual public System.String ThirunitIDName
		{
			get
			{
				return base.GetSystemString(VLendBoxMetadata.ColumnNames.ThirunitIDName);
			}
			
			set
			{
				if(base.SetSystemString(VLendBoxMetadata.ColumnNames.ThirunitIDName, value))
				{
					OnPropertyChanged(VLendBoxMetadata.PropertyNames.ThirunitIDName);
				}
			}
		}		
		
		#endregion	

		#region .str() Properties
		
		public override void SetProperties(IDictionary values)
		{
			foreach (string propertyName in values.Keys)
			{
				this.SetProperty(propertyName, values[propertyName]);
			}
		}
		
		public override void SetProperty(string name, object value)
		{
			esColumnMetadata col = this.Meta.Columns.FindByPropertyName(name);
			if (col != null)
			{
				if(value == null || value is System.String)
				{				
					// Use the strongly typed property
					switch (name)
					{							
						case "LendID": this.str().LendID = (string)value; break;							
						case "ThirdUnitID": this.str().ThirdUnitID = (string)value; break;							
						case "LendDate": this.str().LendDate = (string)value; break;							
						case "Loanee": this.str().Loanee = (string)value; break;							
						case "ReturnDate": this.str().ReturnDate = (string)value; break;							
						case "LoaneeEmail": this.str().LoaneeEmail = (string)value; break;							
						case "ActReturnDate": this.str().ActReturnDate = (string)value; break;							
						case "Attachment": this.str().Attachment = (string)value; break;							
						case "Comments": this.str().Comments = (string)value; break;							
						case "CreatedBy": this.str().CreatedBy = (string)value; break;							
						case "CreatedDttm": this.str().CreatedDttm = (string)value; break;							
						case "UpdatedBy": this.str().UpdatedBy = (string)value; break;							
						case "UpdatedDttm": this.str().UpdatedDttm = (string)value; break;							
						case "LendStatus": this.str().LendStatus = (string)value; break;							
						case "BoxCount": this.str().BoxCount = (string)value; break;							
						case "ThirunitIDName": this.str().ThirunitIDName = (string)value; break;
					}
				}
				else
				{
					switch (name)
					{	
						case "LendID":
						
							if (value == null || value is System.Decimal)
								this.LendID = (System.Decimal?)value;
								OnPropertyChanged(VLendBoxMetadata.PropertyNames.LendID);
							break;
						
						case "ThirdUnitID":
						
							if (value == null || value is System.Decimal)
								this.ThirdUnitID = (System.Decimal?)value;
								OnPropertyChanged(VLendBoxMetadata.PropertyNames.ThirdUnitID);
							break;
						
						case "LendDate":
						
							if (value == null || value is System.DateTime)
								this.LendDate = (System.DateTime?)value;
								OnPropertyChanged(VLendBoxMetadata.PropertyNames.LendDate);
							break;
						
						case "ReturnDate":
						
							if (value == null || value is System.DateTime)
								this.ReturnDate = (System.DateTime?)value;
								OnPropertyChanged(VLendBoxMetadata.PropertyNames.ReturnDate);
							break;
						
						case "ActReturnDate":
						
							if (value == null || value is System.DateTime)
								this.ActReturnDate = (System.DateTime?)value;
								OnPropertyChanged(VLendBoxMetadata.PropertyNames.ActReturnDate);
							break;
						
						case "CreatedDttm":
						
							if (value == null || value is System.DateTime)
								this.CreatedDttm = (System.DateTime?)value;
								OnPropertyChanged(VLendBoxMetadata.PropertyNames.CreatedDttm);
							break;
						
						case "UpdatedDttm":
						
							if (value == null || value is System.DateTime)
								this.UpdatedDttm = (System.DateTime?)value;
								OnPropertyChanged(VLendBoxMetadata.PropertyNames.UpdatedDttm);
							break;
						
						case "LendStatus":
						
							if (value == null || value is System.Int32)
								this.LendStatus = (System.Int32?)value;
								OnPropertyChanged(VLendBoxMetadata.PropertyNames.LendStatus);
							break;
						
						case "BoxCount":
						
							if (value == null || value is System.Int32)
								this.BoxCount = (System.Int32?)value;
								OnPropertyChanged(VLendBoxMetadata.PropertyNames.BoxCount);
							break;
					

						default:
							break;
					}
				}
			}
            else if (this.ContainsColumn(name))
            {
                this.SetColumn(name, value);
            }
			else
			{
				throw new Exception("SetProperty Error: '" + name + "' not found");
			}
		}		

		public esStrings str()
		{
			if (esstrings == null)
			{
				esstrings = new esStrings(this);
			}
			return esstrings;
		}

		sealed public class esStrings
		{
			public esStrings(esVLendBox entity)
			{
				this.entity = entity;
			}
			
	
			public System.String LendID
			{
				get
				{
					System.Decimal? data = entity.LendID;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.LendID = null;
					else entity.LendID = Convert.ToDecimal(value);
				}
			}
				
			public System.String ThirdUnitID
			{
				get
				{
					System.Decimal? data = entity.ThirdUnitID;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ThirdUnitID = null;
					else entity.ThirdUnitID = Convert.ToDecimal(value);
				}
			}
				
			public System.String LendDate
			{
				get
				{
					System.DateTime? data = entity.LendDate;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.LendDate = null;
					else entity.LendDate = Convert.ToDateTime(value);
				}
			}
				
			public System.String Loanee
			{
				get
				{
					System.String data = entity.Loanee;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.Loanee = null;
					else entity.Loanee = Convert.ToString(value);
				}
			}
				
			public System.String ReturnDate
			{
				get
				{
					System.DateTime? data = entity.ReturnDate;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ReturnDate = null;
					else entity.ReturnDate = Convert.ToDateTime(value);
				}
			}
				
			public System.String LoaneeEmail
			{
				get
				{
					System.String data = entity.LoaneeEmail;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.LoaneeEmail = null;
					else entity.LoaneeEmail = Convert.ToString(value);
				}
			}
				
			public System.String ActReturnDate
			{
				get
				{
					System.DateTime? data = entity.ActReturnDate;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ActReturnDate = null;
					else entity.ActReturnDate = Convert.ToDateTime(value);
				}
			}
				
			public System.String Attachment
			{
				get
				{
					System.String data = entity.Attachment;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.Attachment = null;
					else entity.Attachment = Convert.ToString(value);
				}
			}
				
			public System.String Comments
			{
				get
				{
					System.String data = entity.Comments;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.Comments = null;
					else entity.Comments = Convert.ToString(value);
				}
			}
				
			public System.String CreatedBy
			{
				get
				{
					System.String data = entity.CreatedBy;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.CreatedBy = null;
					else entity.CreatedBy = Convert.ToString(value);
				}
			}
				
			public System.String CreatedDttm
			{
				get
				{
					System.DateTime? data = entity.CreatedDttm;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.CreatedDttm = null;
					else entity.CreatedDttm = Convert.ToDateTime(value);
				}
			}
				
			public System.String UpdatedBy
			{
				get
				{
					System.String data = entity.UpdatedBy;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.UpdatedBy = null;
					else entity.UpdatedBy = Convert.ToString(value);
				}
			}
				
			public System.String UpdatedDttm
			{
				get
				{
					System.DateTime? data = entity.UpdatedDttm;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.UpdatedDttm = null;
					else entity.UpdatedDttm = Convert.ToDateTime(value);
				}
			}
				
			public System.String LendStatus
			{
				get
				{
					System.Int32? data = entity.LendStatus;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.LendStatus = null;
					else entity.LendStatus = Convert.ToInt32(value);
				}
			}
				
			public System.String BoxCount
			{
				get
				{
					System.Int32? data = entity.BoxCount;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.BoxCount = null;
					else entity.BoxCount = Convert.ToInt32(value);
				}
			}
				
			public System.String ThirunitIDName
			{
				get
				{
					System.String data = entity.ThirunitIDName;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ThirunitIDName = null;
					else entity.ThirunitIDName = Convert.ToString(value);
				}
			}
			

			private esVLendBox entity;
		}
		
		[NonSerialized]
		private esStrings esstrings;		
		
		#endregion
		
		#region Housekeeping methods

		override protected IMetadata Meta
		{
			get
			{
				return VLendBoxMetadata.Meta();
			}
		}

		#endregion		
		
		#region Query Logic

		public VLendBoxQuery Query
		{
			get
			{
				if (this.query == null)
				{
					this.query = new VLendBoxQuery();
					InitQuery(this.query);
				}

				return this.query;
			}
		}

		public bool Load(VLendBoxQuery query)
		{
			this.query = query;
			InitQuery(this.query);
			return this.Query.Load();
		}
		
		protected void InitQuery(VLendBoxQuery query)
		{
			query.OnLoadDelegate = this.OnQueryLoaded;
			
			if (!query.es2.HasConnection)
			{
				query.es2.Connection = ((IEntity)this).Connection;
			}			
		}

		#endregion
		
        [IgnoreDataMember]
		private VLendBoxQuery query;		
	}



	[Serializable]
	abstract public partial class esVLendBoxCollection : esEntityCollection<VLendBox>
	{
		#region Housekeeping methods
		override protected IMetadata Meta
		{
			get
			{
				return VLendBoxMetadata.Meta();
			}
		}

		protected override string GetCollectionName()
		{
			return "VLendBoxCollection";
		}

		#endregion		
		
		#region Query Logic

	#if (!WindowsCE)
		[BrowsableAttribute(false)]
	#endif
		public VLendBoxQuery Query
		{
			get
			{
				if (this.query == null)
				{
					this.query = new VLendBoxQuery();
					InitQuery(this.query);
				}

				return this.query;
			}
		}

		public bool Load(VLendBoxQuery query)
		{
			this.query = query;
			InitQuery(this.query);
			return Query.Load();
		}

		override protected esDynamicQuery GetDynamicQuery()
		{
			if (this.query == null)
			{
				this.query = new VLendBoxQuery();
				this.InitQuery(query);
			}
			return this.query;
		}

		protected void InitQuery(VLendBoxQuery query)
		{
			query.OnLoadDelegate = this.OnQueryLoaded;
			
			if (!query.es2.HasConnection)
			{
				query.es2.Connection = ((IEntityCollection)this).Connection;
			}			
		}

		protected override void HookupQuery(esDynamicQuery query)
		{
			this.InitQuery((VLendBoxQuery)query);
		}

		#endregion
		
		private VLendBoxQuery query;
	}



	[Serializable]
	abstract public partial class esVLendBoxQuery : esDynamicQuery
	{
		override protected IMetadata Meta
		{
			get
			{
				return VLendBoxMetadata.Meta();
			}
		}	
		
		#region QueryItemFromName
		
        protected override esQueryItem QueryItemFromName(string name)
        {
            switch (name)
            {
				case "LendID": return this.LendID;
				case "ThirdUnitID": return this.ThirdUnitID;
				case "LendDate": return this.LendDate;
				case "Loanee": return this.Loanee;
				case "ReturnDate": return this.ReturnDate;
				case "LoaneeEmail": return this.LoaneeEmail;
				case "ActReturnDate": return this.ActReturnDate;
				case "Attachment": return this.Attachment;
				case "Comments": return this.Comments;
				case "CreatedBy": return this.CreatedBy;
				case "CreatedDttm": return this.CreatedDttm;
				case "UpdatedBy": return this.UpdatedBy;
				case "UpdatedDttm": return this.UpdatedDttm;
				case "LendStatus": return this.LendStatus;
				case "BoxCount": return this.BoxCount;
				case "ThirunitIDName": return this.ThirunitIDName;

                default: return null;
            }
        }		
		
		#endregion
		
		#region esQueryItems

		public esQueryItem LendID
		{
			get { return new esQueryItem(this, VLendBoxMetadata.ColumnNames.LendID, esSystemType.Decimal); }
		} 
		
		public esQueryItem ThirdUnitID
		{
			get { return new esQueryItem(this, VLendBoxMetadata.ColumnNames.ThirdUnitID, esSystemType.Decimal); }
		} 
		
		public esQueryItem LendDate
		{
			get { return new esQueryItem(this, VLendBoxMetadata.ColumnNames.LendDate, esSystemType.DateTime); }
		} 
		
		public esQueryItem Loanee
		{
			get { return new esQueryItem(this, VLendBoxMetadata.ColumnNames.Loanee, esSystemType.String); }
		} 
		
		public esQueryItem ReturnDate
		{
			get { return new esQueryItem(this, VLendBoxMetadata.ColumnNames.ReturnDate, esSystemType.DateTime); }
		} 
		
		public esQueryItem LoaneeEmail
		{
			get { return new esQueryItem(this, VLendBoxMetadata.ColumnNames.LoaneeEmail, esSystemType.String); }
		} 
		
		public esQueryItem ActReturnDate
		{
			get { return new esQueryItem(this, VLendBoxMetadata.ColumnNames.ActReturnDate, esSystemType.DateTime); }
		} 
		
		public esQueryItem Attachment
		{
			get { return new esQueryItem(this, VLendBoxMetadata.ColumnNames.Attachment, esSystemType.String); }
		} 
		
		public esQueryItem Comments
		{
			get { return new esQueryItem(this, VLendBoxMetadata.ColumnNames.Comments, esSystemType.String); }
		} 
		
		public esQueryItem CreatedBy
		{
			get { return new esQueryItem(this, VLendBoxMetadata.ColumnNames.CreatedBy, esSystemType.String); }
		} 
		
		public esQueryItem CreatedDttm
		{
			get { return new esQueryItem(this, VLendBoxMetadata.ColumnNames.CreatedDttm, esSystemType.DateTime); }
		} 
		
		public esQueryItem UpdatedBy
		{
			get { return new esQueryItem(this, VLendBoxMetadata.ColumnNames.UpdatedBy, esSystemType.String); }
		} 
		
		public esQueryItem UpdatedDttm
		{
			get { return new esQueryItem(this, VLendBoxMetadata.ColumnNames.UpdatedDttm, esSystemType.DateTime); }
		} 
		
		public esQueryItem LendStatus
		{
			get { return new esQueryItem(this, VLendBoxMetadata.ColumnNames.LendStatus, esSystemType.Int32); }
		} 
		
		public esQueryItem BoxCount
		{
			get { return new esQueryItem(this, VLendBoxMetadata.ColumnNames.BoxCount, esSystemType.Int32); }
		} 
		
		public esQueryItem ThirunitIDName
		{
			get { return new esQueryItem(this, VLendBoxMetadata.ColumnNames.ThirunitIDName, esSystemType.String); }
		} 
		
		#endregion
		
	}



	[Serializable]
	public partial class VLendBoxMetadata : esMetadata, IMetadata
	{
		#region Protected Constructor
		protected VLendBoxMetadata()
		{
			m_columns = new esColumnMetadataCollection();
			esColumnMetadata c;

			c = new esColumnMetadata(VLendBoxMetadata.ColumnNames.LendID, 0, typeof(System.Decimal), esSystemType.Decimal);
			c.PropertyName = VLendBoxMetadata.PropertyNames.LendID;
			c.NumericPrecision = 18;
			m_columns.Add(c);
				
			c = new esColumnMetadata(VLendBoxMetadata.ColumnNames.ThirdUnitID, 1, typeof(System.Decimal), esSystemType.Decimal);
			c.PropertyName = VLendBoxMetadata.PropertyNames.ThirdUnitID;
			c.NumericPrecision = 18;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(VLendBoxMetadata.ColumnNames.LendDate, 2, typeof(System.DateTime), esSystemType.DateTime);
			c.PropertyName = VLendBoxMetadata.PropertyNames.LendDate;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(VLendBoxMetadata.ColumnNames.Loanee, 3, typeof(System.String), esSystemType.String);
			c.PropertyName = VLendBoxMetadata.PropertyNames.Loanee;
			c.CharacterMaxLength = 50;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(VLendBoxMetadata.ColumnNames.ReturnDate, 4, typeof(System.DateTime), esSystemType.DateTime);
			c.PropertyName = VLendBoxMetadata.PropertyNames.ReturnDate;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(VLendBoxMetadata.ColumnNames.LoaneeEmail, 5, typeof(System.String), esSystemType.String);
			c.PropertyName = VLendBoxMetadata.PropertyNames.LoaneeEmail;
			c.CharacterMaxLength = 100;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(VLendBoxMetadata.ColumnNames.ActReturnDate, 6, typeof(System.DateTime), esSystemType.DateTime);
			c.PropertyName = VLendBoxMetadata.PropertyNames.ActReturnDate;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(VLendBoxMetadata.ColumnNames.Attachment, 7, typeof(System.String), esSystemType.String);
			c.PropertyName = VLendBoxMetadata.PropertyNames.Attachment;
			c.CharacterMaxLength = 60;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(VLendBoxMetadata.ColumnNames.Comments, 8, typeof(System.String), esSystemType.String);
			c.PropertyName = VLendBoxMetadata.PropertyNames.Comments;
			c.CharacterMaxLength = 500;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(VLendBoxMetadata.ColumnNames.CreatedBy, 9, typeof(System.String), esSystemType.String);
			c.PropertyName = VLendBoxMetadata.PropertyNames.CreatedBy;
			c.CharacterMaxLength = 50;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(VLendBoxMetadata.ColumnNames.CreatedDttm, 10, typeof(System.DateTime), esSystemType.DateTime);
			c.PropertyName = VLendBoxMetadata.PropertyNames.CreatedDttm;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(VLendBoxMetadata.ColumnNames.UpdatedBy, 11, typeof(System.String), esSystemType.String);
			c.PropertyName = VLendBoxMetadata.PropertyNames.UpdatedBy;
			c.CharacterMaxLength = 50;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(VLendBoxMetadata.ColumnNames.UpdatedDttm, 12, typeof(System.DateTime), esSystemType.DateTime);
			c.PropertyName = VLendBoxMetadata.PropertyNames.UpdatedDttm;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(VLendBoxMetadata.ColumnNames.LendStatus, 13, typeof(System.Int32), esSystemType.Int32);
			c.PropertyName = VLendBoxMetadata.PropertyNames.LendStatus;
			c.NumericPrecision = 10;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(VLendBoxMetadata.ColumnNames.BoxCount, 14, typeof(System.Int32), esSystemType.Int32);
			c.PropertyName = VLendBoxMetadata.PropertyNames.BoxCount;
			c.NumericPrecision = 10;
			c.IsNullable = true;
			m_columns.Add(c);
				
			c = new esColumnMetadata(VLendBoxMetadata.ColumnNames.ThirunitIDName, 15, typeof(System.String), esSystemType.String);
			c.PropertyName = VLendBoxMetadata.PropertyNames.ThirunitIDName;
			c.CharacterMaxLength = 100;
			m_columns.Add(c);
				
		}
		#endregion	
	
		static public VLendBoxMetadata Meta()
		{
			return meta;
		}	
		
		public Guid DataID
		{
			get { return base.m_dataID; }
		}	
		
		public bool MultiProviderMode
		{
			get { return false; }
		}		

		public esColumnMetadataCollection Columns
		{
			get	{ return base.m_columns; }
		}
		
		#region ColumnNames
		public class ColumnNames
		{ 
			 public const string LendID = "LendID";
			 public const string ThirdUnitID = "ThirdUnitID";
			 public const string LendDate = "LendDate";
			 public const string Loanee = "Loanee";
			 public const string ReturnDate = "ReturnDate";
			 public const string LoaneeEmail = "LoaneeEmail";
			 public const string ActReturnDate = "ActReturnDate";
			 public const string Attachment = "Attachment";
			 public const string Comments = "Comments";
			 public const string CreatedBy = "CreatedBy";
			 public const string CreatedDttm = "CreatedDttm";
			 public const string UpdatedBy = "UpdatedBy";
			 public const string UpdatedDttm = "UpdatedDttm";
			 public const string LendStatus = "LendStatus";
			 public const string BoxCount = "BoxCount";
			 public const string ThirunitIDName = "ThirunitIDName";
		}
		#endregion	
		
		#region PropertyNames
		public class PropertyNames
		{ 
			 public const string LendID = "LendID";
			 public const string ThirdUnitID = "ThirdUnitID";
			 public const string LendDate = "LendDate";
			 public const string Loanee = "Loanee";
			 public const string ReturnDate = "ReturnDate";
			 public const string LoaneeEmail = "LoaneeEmail";
			 public const string ActReturnDate = "ActReturnDate";
			 public const string Attachment = "Attachment";
			 public const string Comments = "Comments";
			 public const string CreatedBy = "CreatedBy";
			 public const string CreatedDttm = "CreatedDttm";
			 public const string UpdatedBy = "UpdatedBy";
			 public const string UpdatedDttm = "UpdatedDttm";
			 public const string LendStatus = "LendStatus";
			 public const string BoxCount = "BoxCount";
			 public const string ThirunitIDName = "ThirunitIDName";
		}
		#endregion	

		public esProviderSpecificMetadata GetProviderMetadata(string mapName)
		{
			MapToMeta mapMethod = mapDelegates[mapName];

			if (mapMethod != null)
				return mapMethod(mapName);
			else
				return null;
		}
		
		#region MAP esDefault
		
		static private int RegisterDelegateesDefault()
		{
			// This is only executed once per the life of the application
			lock (typeof(VLendBoxMetadata))
			{
				if(VLendBoxMetadata.mapDelegates == null)
				{
					VLendBoxMetadata.mapDelegates = new Dictionary<string,MapToMeta>();
				}
				
				if (VLendBoxMetadata.meta == null)
				{
					VLendBoxMetadata.meta = new VLendBoxMetadata();
				}
				
				MapToMeta mapMethod = new MapToMeta(meta.esDefault);
				mapDelegates.Add("esDefault", mapMethod);
				mapMethod("esDefault");
			}
			return 0;
		}			

		private esProviderSpecificMetadata esDefault(string mapName)
		{
			if(!m_providerMetadataMaps.ContainsKey(mapName))
			{
				esProviderSpecificMetadata meta = new esProviderSpecificMetadata();			


				meta.AddTypeMap("LendID", new esTypeMap("numeric", "System.Decimal"));
				meta.AddTypeMap("ThirdUnitID", new esTypeMap("numeric", "System.Decimal"));
				meta.AddTypeMap("LendDate", new esTypeMap("datetime", "System.DateTime"));
				meta.AddTypeMap("Loanee", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("ReturnDate", new esTypeMap("datetime", "System.DateTime"));
				meta.AddTypeMap("LoaneeEmail", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("ActReturnDate", new esTypeMap("datetime", "System.DateTime"));
				meta.AddTypeMap("Attachment", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("Comments", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("CreatedBy", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("CreatedDttm", new esTypeMap("datetime", "System.DateTime"));
				meta.AddTypeMap("UpdatedBy", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("UpdatedDttm", new esTypeMap("datetime", "System.DateTime"));
				meta.AddTypeMap("LendStatus", new esTypeMap("int", "System.Int32"));
				meta.AddTypeMap("BoxCount", new esTypeMap("int", "System.Int32"));
				meta.AddTypeMap("ThirunitIDName", new esTypeMap("nvarchar", "System.String"));			
				
				
				
				meta.Source = "V_LendBox";
				meta.Destination = "V_LendBox";
				
				meta.spInsert = "proc_V_LendBoxInsert";				
				meta.spUpdate = "proc_V_LendBoxUpdate";		
				meta.spDelete = "proc_V_LendBoxDelete";
				meta.spLoadAll = "proc_V_LendBoxLoadAll";
				meta.spLoadByPrimaryKey = "proc_V_LendBoxLoadByPrimaryKey";
				
				this.m_providerMetadataMaps["esDefault"] = meta;
			}
			
			return this.m_providerMetadataMaps["esDefault"];
		}

		#endregion

		static private VLendBoxMetadata meta;
		static protected Dictionary<string, MapToMeta> mapDelegates;
		static private int _esDefault = RegisterDelegateesDefault();
	}
}
